﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace CourierManager
{
    public class Truck : TransportUnit
    {
        //we assume that the truck has a maximum capacity of 5000
        public Truck(string licensePlate, TransportUnitState state = TransportUnitState.Available)
            : base(licensePlate, 5000, state)
        {

        }

        public Truck(string brand, string licensePlate, int capacity)
            : base(brand, licensePlate, capacity)
        {

        }

        public override void SaveVehicleData()
        {
            string path = "../../../CourierManager/AllVehicles.txt";
            StreamWriter writer = new StreamWriter(path, true);
            using (writer)
            {
                string currentTruck = String.Format("{0}*{1}*{2}*{3}*{4}*{5}", this.GetType().Name, this.Brand, this.LicensePlate,
                    this.Capacity, this.FuelConsumption, this.ProductionDate);
                writer.WriteLine(currentTruck);
            }
        }
    }
}
